import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        userId: "",
        userName: "",
        userType: "manager",
    },
    mutations: {
        setUserId: function (state, newUserId) {
            console.log("This is store's setUserId");
            if (newUserId !== undefined) {
                state.userId = newUserId;
                console.log("success");
                console.log(state.userId);
            }
        },
        setUserName: function (state, newUserName) {
            if (newUserName !== undefined) {
                state.userName = newUserName;
            }
        },
        setUserType: function (state, newUserType) {
            if (newUserType !== undefined) {
                state.userType = newUserType;
            }
        }
    },
    actions: {}
})
